#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<set>
using namespace std;
int evalRPN(vector<string>& tokens) {
    set<string> s = { "+","-","*","/" };
    stack<int> st;
    for (auto& str : tokens) {
        if (s.find(str) != s.end()) {
            int right = st.top();
            st.pop();
            int left = st.top();
            st.pop();
            switch (str[0]) {
            case '+':
                st.push(left + right);
                break;
            case '-':
                st.push(left - right);
                break;
            case '*':
                st.push(left * right);
                break;
            case '/':
                st.push(left / right);
                break;
            }
        }
        else {
            st.push(stoi(str));
        }
    }
    return st.top();
}
int main()
{
    vector<string> nums = {"5","4","3","*","+","2","-"};
    int ret = evalRPN(nums);
    cout << ret;

    return 0;
}